package com.wytest.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.wytest.dao.EventMapper;
import com.wytest.entity.Event;
import com.wytest.entity.EventExample;
import com.wytest.service.EventService;

@Service
public class EventServiceImpl implements EventService {
	@Resource
	private EventMapper eventMapper;
	//查询所有信息
	public List<Event> getAll() {
		EventExample eventExample=new EventExample();
		eventExample.createCriteria();
		List<Event> list=eventMapper.selectByExample(eventExample);
		return list;
	}
	
	//添加事件
	public int add(Event event) {
		return eventMapper.insertSelective(event);
	}

	//修改事件
	public int update(Event event) {
		return eventMapper.updateByPrimaryKey(event);
	}

	//根据id查询事件
	public Event showbyid(int eid) {
		Event event= eventMapper.selectByPrimaryKey(eid);
		return event;
	}

	public int del(int eid) {
		return eventMapper.deleteByPrimaryKey(eid);
	}

}
